package com.org.api.admin.entity.po;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.org.api.admin.service.CmsUserBaseService;
import com.org.platform.support.conponents.SpringApplicationContextAware;

/**
 * @Description
 * @auther dh
 * @date 2022/2/21 16:13
 */

public class CmsUserRedisIndexModule<K> {
	private Long moduleConfigId;
	private String moduleType;
	private Integer orderSort;
	private Integer isDelete;
	private long expireTime;

	@JsonIgnore
	private CmsUserBaseService cmsUserBaseService;

	@JsonIgnore
	private K moduleDetailData;

	public CmsUserRedisIndexModule() {

	}

	public CmsUserRedisIndexModule(Long moduleConfigId, Integer orderSort, Integer isDelete, long expireTime, CmsUserModuleEnum cmsUserModuleEnum) {
		this.moduleConfigId = moduleConfigId;
		this.moduleType = cmsUserModuleEnum.getModuleType();
		this.orderSort = orderSort;
		this.isDelete = isDelete;
		this.expireTime = expireTime;
		this.cmsUserBaseService = (CmsUserBaseService) SpringApplicationContextAware.getApplicationContext().getBean(cmsUserModuleEnum.getaClass());
	}

	public void fillServiceClass() {
		this.cmsUserBaseService = CmsUserModuleEnum.getServiceClass(this.moduleType);
	}

	public Long getModuleConfigId() {
		return moduleConfigId;
	}

	public void setModuleConfigId(Long moduleConfigId) {
		this.moduleConfigId = moduleConfigId;
	}

	public String getModuleType() {
		return moduleType;
	}

	public void setModuleType(String moduleType) {
		this.moduleType = moduleType;
	}

	public Integer getOrderSort() {
		return orderSort;
	}

	public void setOrderSort(Integer orderSort) {
		this.orderSort = orderSort;
	}

	public Integer getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}

	public long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}

	public K getModuleDetailData() {
		return moduleDetailData;
	}

	public void setModuleDetailData(K moduleDetailData) {
		this.moduleDetailData = moduleDetailData;
	}

	public CmsUserBaseService getCmsUserBaseService() {
		return cmsUserBaseService;
	}

	public void setCmsUserBaseService(CmsUserBaseService cmsUserBaseService) {
		this.cmsUserBaseService = cmsUserBaseService;
	}
}
